layui.define(function(exports){
    //区块轮播切换
    layui.use(['admin', 'carousel'], function(){
        var $ = layui.$,
        carousel = layui.carousel,
        device = layui.device();

        //轮播切换
        $('.layadmin-carousel').each(function(){
            var othis = $(this);
            carousel.render({
                elem: this,
                width: '100%',
                arrow: 'none',
                interval: othis.data('interval'),
                autoplay: othis.data('autoplay') === true,
                trigger: (device.ios || device.android) ? 'click' : 'hover',
                anim: othis.data('anim')
            });
        });

    });


    layui.use('table', function(){
        var $ = layui.$;

        // 数据分析占比图
        var zhanbi = echarts.init(document.querySelector(".zhanbi"));
        var option = {
            grid: {
              left: '3%',
              right: '4%',
              bottom: '3%',
              containLabel: true
            },
            tooltip: {
              trigger: 'item'
            },
            legend: {
              show: false
            },
            series: [
              {
                name: '数据分析占比图',
                type: 'pie',
                radius: '50%',
                data: [
                    { value: 1048, name: '微信' },
                    { value: 735, name: '抖音' },
                    { value: 580, name: '搜狐' },
                    { value: 484, name: '新浪' }
                ],
                label: {
                    normal: {
                        show: true,
                        position: 'inside',
                        formatter: '{d}%'
                    }
                },
                emphasis: {
                  itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                  }
                }
              }
            ]
        };
        zhanbi.setOption(option);

        // 数据分析趋势图
        var qushi = echarts.init(document.querySelector(".qushi"));
        var option2 = {
            grid: {
              left: '3%',
              right: '4%',
              bottom: '3%',
              containLabel: true
            },
            xAxis: {
              data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
            },
            yAxis: {},
            series: [
              {
                name: '数据分析趋势图',
                type: 'line',
                data:[220, 182, 191, 234, 290, 330, 310, 220, 182, 0, 0, 0]
              }
            ]
        };
        qushi.setOption(option2);

        // 数据分析实时图
        var shishi = echarts.init(document.querySelector(".shishi"));
        var option3 = {
            grid: {
              left: '3%',
              right: '4%',
              bottom: '3%',
              containLabel: true
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['9:00', '9:05', '9:10', '9:15', '9:20', '9:25', '9:30']
            },
            yAxis: {
            },
            series: [{
                name: '流入（M）',
                type: 'line',
                data: [120, 132, 101, 134, 90, 230, 210]
            }, {
                name: '流出（M）',
                type: 'line',
                data: [220, 182, 191, 234, 290, 330, 310]
            }, {
                name: '总流量（M）',
                type: 'line',
                data: [340, 314, 292, 368, 380, 560, 520]
            }]
        };
        shishi.setOption(option3);

        // 数据分析区域图
        var quyu = echarts.init(document.querySelector(".quyu"));
        var option4 = {
            grid: {
              left: '3%',
              right: '4%',
              bottom: '3%',
              containLabel: true
            },
            xAxis: {
              type: 'category',
              boundaryGap: false,
              data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
              type: 'value'
            },
            series: [
              {
                data: [820, 932, 901, 934, 1290, 1330, 1320],
                type: 'line',
                areaStyle: {}
              }
            ]
        };

        quyu.setOption(option4);
    });

    exports('fenxi', {})
});